home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 2587 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.0 KB

  1. Path: doc.ic.ac.uk!not-for-mail
  2. From: mdf@doc.ic.ac.uk (Martin Frost)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: silly c problem
  5. Date: 2 Feb 1996 13:38:56 -0000
  6. Organization: Dept. of Computing, Imperial College, University of London, UK.
  7. Distribution: world
  8. Message-ID: <4et45g$38c@oak61.doc.ic.ac.uk>
  9. References: <f2c_9601302132@techtol.magic.mb.ca>
  10. Reply-To: mdf@doc.ic.ac.uk (Martin Frost)
  11. NNTP-Posting-Host: oak61.doc.ic.ac.uk
  12. X-Newsreader: mxrn 6.18-23
  13.  
  14.  
  15. In article <f2c_9601302132@techtol.magic.mb.ca>, tahir.khawaja@techtol.magic.mb.ca (Tahir Khawaja) writes:
  16. >  printf("You entered %d and %d.\n\n", &num1, &num2);
  17.                                         ^      ^
  18. The & operator gives a pointer to the value. This is necessary for scanf
  19. as it changes the value given, but if you pass it to printf, you will just
  20. get a big number printed, which is the address of the variable. This is
  21. occasionally ueful for debugging, but rarely otherwise.
  22.  
  23. Remove the & in this line and the other one with printf in, and you will be
  24. OK.
  25.